package test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import test.couchdb.ModelsDb;

@Controller
public class RootController {
    @Autowired
    private ModelsDb modelsDb;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String get(Model model) {
        model.addAttribute("models", modelsDb.getModelsView().createQuery().asValues());

        return "main";
    }
}